using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;

namespace Janus.NorthwindDemo2007
{
	public partial class ProductsAndOrdersDashboardView
	{

		public override Janus.NorthwindDemo2007.FolderView[] GetDefinedViews()
		{
			return new FolderView[] {new FolderView("Northwind Products & Orders", ContentViewType.DashBoard, "")};

		}

        private void explorerBar_ItemClick(object sender, Janus.Windows.ExplorerBar.ItemEventArgs e)
        {
            switch (e.Item.Key)
            {
                case "NewProduct":
                    NewItem("Products");
                    break;
                case "GoToProducts":
                    GoToFolder("Products");
                    break;
                case "NewOrder":
                    NewItem("Orders");
                    break;
                case "GoToOrders":
                    GoToFolder("Orders");
                    break;
            }
        }
        private void GoToFolder(string folderName)
        {
            ApplicationFolder folder = null;
            folder = NorthwindApp.RootFolder.Find(folderName);
            if (folder != null)
            {
                NorthwindApp.MainForm.CurrentFolder = folder;
            }
        }
        private void NewItem(string foldername)
        {
            ApplicationFolder folder = null;
            folder = NorthwindApp.RootFolder.Find(foldername);
            if (folder != null)
            {
                folder.AddNew();
            }
        }

        private void ribbon1_CommandClick(object sender, Janus.Windows.Ribbon.CommandEventArgs e)
        {
            switch (e.Command.Key)
            {
                case "rcmdProducts":
                    GoToFolder("Products");
                    break;
                case "rcmdOrders":
                    GoToFolder("Orders");
                    break;
            }
        }
	}

} //end of root namespace